﻿using System;
using System.Windows.Markup;
using Garfield.Core.Runtime;

namespace Garfield.Presentation.Markup
{
    public abstract class MarkupExtensionBase : MarkupExtension
    {
        internal static IServiceLocator ServiceLocator;

        public sealed override object ProvideValue(IServiceProvider serviceProvider)
        {
            return ProvideValue(serviceProvider, ServiceLocator, ServiceLocator.GetService<IExtensionRegistry>());
        }

        protected abstract object ProvideValue(IServiceProvider provider, IServiceLocator locator, IExtensionRegistry registry);
    }
}
